package com.baor.controller;

import com.baor.service.ScriptService;
import com.baor.util.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping(value="script")
public class ScriptController {

    @Autowired
    private ScriptService scriptService;

    @RequestMapping(value="/list")
    public R list(@RequestBody Map<String,Object> params){
        log.info("查询话术列表，参数：{}", params);
        return scriptService.scriptList(params);
    }

    @RequestMapping(value="/addScript")  // 修正路径为/addScript（规范路径格式）
    public R addScript(@RequestBody Map<String,Object> params){
        log.info("添加话术，参数：{}", params);
        return scriptService.scriptAdd(params);
    }

    @RequestMapping(value="/updateScript")  // 修正路径为/updateScript（规范路径格式）
    public R updateScript(@RequestBody Map<String,Object> params){
        log.info("编辑话术，参数：{}", params);
        return scriptService.scriptUpdate(params);
    }
}